var uid = location.search.substr(location.search.indexOf('=') + 1)
var icon = "https://appoint-img.oss-cn-shanghai.aliyuncs.com/user-img/pdwSBkscES.jpg?x-oss-process=style/appoint-feast";
var app = new Vue({
  el: "#inputinfo",
  data: {
    ilist: getUserById()
  },
  methods: {
    editUsersById(id) {
      $.ajax({
        url: 'http://47.102.45.219:8080/Appoint/editUserServlet/editUser',
        data: $("form").serialize(),
        dataType: 'json',
        type: 'post',
        async: false,
        success: function (data) {
          if (data.statu) {

            xadmin.close();
            layer.msg('修改成功!', {
              icon: 1,
              time: 1000
            });
            xadmin.father_reload();
          } else {
            layer.msg('修改失败!', {
              icon: 1,
              time: 1000
            });
          }
        }

      })

    }
  }
})


// function editUsersById(id) {
//   //alert('a')
//   $.post("http://localhost:8080/Appoint/editUserServlet/editUser", $("form").serialize(), function (data) {
//     xadmin.close();
//     xadmin.father_reload();


//   })
// }

//根据id获取user信息
function getUserById() {
  //alert(location.search)
  // alert(uid)
  var list
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/editUserServlet/getUserById',
    data: {
      "id": uid
    },
    dataType: 'json',
    async: false,
    success: function (data) {
      if (data.statu != 0) {
        list = data.data
        //var count = list.length
        // alert(list)

      } else {
        alert(data.msg)
      }
    }
  })
  return list

}